<?php
/**
 * User: yuesir
 * Date: 2016/4/28
 * Time: 21:39
 * 事件生成器：主要包含 addObserver/notify 这2个方法
 */

namespace Lib;


abstract class EventGenerator {
    protected $observers = array();

    function addObserver(Observer $observer)
    {
        $this->observers[] = $observer;
    }


    function notify()
    {
        foreach($this->observers as $observer) {
            $observer->update();
        }
    }
}